<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- v-model 本质就是一个语法糖，在input标签上等于 :value + @input -->
    账户：<input :value="userName" @input="dealInput"   type="text"> <br><br>
    密码：<input v-model="password" type="password"> <br><br>
    <button @click="login">登录</button>
    <button @click="reset">重置</button>
  </div>
  <script src="./vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        userName:'wangning',
        password:'666666'
      },
      methods:{
        login(){
          alert(`用户名:${this.userName},密码:${this.password}`)
        },
        reset(){
          this.userName = ""
          this.password = ""
        },
        dealInput(event){
          this.userName = event.target.value
        }
      }
    })
  </script>
</body>
</html>